<%@ Language=VBScript %>
<%
	Session("bChucnang")=1
	Session("FormName")="F46"
%>
<!--#include file="..\CheckSession.inc"-->	
<!--#include file="..\Report.inc"-->
<%
	bchon=Request("bchon")
	sDieuKien=Request("sDieuKien")
	if bchon="all" then
		sSQL="select totrinh.*,htxltotrinh.*,donvi.tendonvi from totrinh left outer join htxltotrinh on totrinh.id=htxltotrinh.idtotrinh left outer join donvi on htxltotrinh.madonvi = donvi.madonvi where "& sDieuKien &" not totrinh.hanxl is null order by ngayden,soden"
		CAll RP("rptthxltotrinh.rpt",sSQL)
	else
		sSQL="select totrinh.*,htxltotrinh.* from totrinh left outer join htxltotrinh on totrinh.id=htxltotrinh.idtotrinh where "& sDieuKien &" not totrinh.hanxl is null and totrinh.donvixl like '%"& Session("bMaDonVi") &"%' order by ngayden,soden"
		CAll RP("rptthxltotrinhdonvi.rpt",sSQL)
	end if
%><!-- #include file="SmartViewerActiveX.asp" -->
<%
	Conn.Close
	Set Conn=nothing
%>